package ar.com.vates.threads2;

import java.util.Random;

public class ThreadBorrar implements Runnable {

	private Contenedor contenedor;
	private Random rnd;

	public ThreadBorrar(Contenedor contenedor) {
		this.contenedor = contenedor;
		this.rnd = new Random();
	}

	@Override
	public void run() {
		while (true) {
			try {
				Thread.sleep(rnd.nextInt(5000) + 1);
				contenedor.borrarVariable();
			} catch (InterruptedException e) {
				System.out.println("Error al borrar");
			}
		}
	}

}